package com.mochen.mall.controller;

import com.mochen.mall.common.CommonResult;
import com.mochen.mall.service.UmsMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 会员登录注册管理Controller
 *
 * Created by macro on 2018/8/3.
 */

@Controller
@RequestMapping("/sso")
public class UmsMemberController {

	@Autowired
	private UmsMemberService memberService;

	@RequestMapping(value = "/getAuthCode", method = RequestMethod.GET)
	@ResponseBody
	public CommonResult getAuthCode(@RequestParam String telephone) {
		return memberService.generateAuthCode(telephone);
	}

	@RequestMapping(value = "/verifyAuthCode", method = RequestMethod.POST)
	@ResponseBody
	public CommonResult updatePassword(@RequestParam String telephone, @RequestParam String authCode) {
		return memberService.verifyAuthCode(telephone, authCode);

	}

}